{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--搜索框开始-->
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item">
                        <div class="col-sm-12">
                            <div class="input-group" >
                                <button  class="btn btn-danger m-l-xs" href="javascript:;" data-toggle="dropdown">
                                    <i class="fa fa-wrench"></i> 批量操作 <span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu layui-anim layui-anim-upbit" role="menu">
                                    <li><a  href="javascript:;" class="layuiBtn" data-type="excelIn"><i class="fa fa-external-link"></i> 批量导出</a></li>
                                    <li><a  href="javascript:;" class="layuiBtn" data-type="excelAllNoSelect"><i class="fa fa-external-link"></i> 全部导出</a></li>
                                    <!--<li><a  href="javascript:;" class="layuiBtn" data-type="excelIn"><i class="fa fa-external-link"></i> 批量导入</a></li>-->
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
                <!--操作框结束-->
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="demo"></table>
                </div>
            </div>
        </div>
    </div>
</div>
<textarea id="allidsForOut" class="hidden"></textarea>
{include file="public/footer" /}

<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
                , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("curriculum/basic")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            ,limits: [5, 10, 15, 20, 25, 30]
            ,limit: "{:config('pages')}"
            ,loading: true
            , where: {id:{:session('curriculum_id')}}
            ,id:'testReload'
                , cols: [[
            {type: 'checkbox', fixed: 'left',}
            ,{type:'numbers', width: 80, title: '序号'}
            , {field: 'st_pay_time', width: 200, title: '报名时间', align: 'center'}
            , {field: 'st_user_id', width: 180, title: '用户ID', align: 'center'}
            , {field: 'user_username', width: 200, title: '用户昵称', align: 'center'}
            , {field: 'school', width: 200, title: '学校', align: 'center'}
            , {field: 'grade_class', width: 200, title: '年级-班级', align: 'center'}
            , {field: 'user_phone', width: 190, title: '手机号码', align: 'center'}
            , {field: 'st_money', width: 190, title: '报名费用', align: 'center'}
            , {field: 'st_user_name', width: 190, title: '报名用户姓名', align: 'center'}
            , {field: 'st_user_code', width: 190, title: '报名身份证号码', align: 'center'}
            , {field: 'st_user_phone', width: 190, title: '报名紧急联系电话', align: 'center'}
            , {field: 'st_urg_name', width: 190, title: '紧急联系人', align: 'center'}
            , {field: 'st_pay_type', width: 190, title: '支付方式', align: 'center'}
            , {field: 'st_pay_num', width: 190, title: '订单号', align: 'center'}
        ]]
        ,done: function (res, curr, count) {
            $('#allidsForOut').val(res.count2);
        }
    });

        //批量操作
        var $ = layui.$, active = {
            excelIn: function(){
                //导出Excel
                wk.excelAll(getIds(),$('.layui-input').serialize(),"{:url('excelIn')}");
            },
            excelAllNoSelect: function(){
                //导出Excel
                wk.excelAllNoSelect($('#allidsForOut').val(),$('.layui-input').serialize(),"{:url('excelIn')}");
            }
        };
        $('.layuiBtn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
        var getIds = function () {
            var ids = [];
            var checkStatus = table.checkStatus('testReload')
                    ,data = checkStatus.data;
            $.each(data,function(index,item){
                ids.push(item['st_id'])
            });
            return ids;
        }
    });
</script>
</body>
</html>